/* global window */
import { message } from 'antd'
import api from 'api'
import modelExtend from 'dva-model-extend'
import { pathMatchRegexp } from 'utils'
import { pageModel } from 'utils/model'

const {} = api

export default modelExtend(pageModel, {
  namespace: 'roles',

  state: {
    data: {},
  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(location => {
        if (pathMatchRegexp('/map', location.pathname)) {
          // console.log("call map query");
          dispatch({
            type: 'query',
            // payload,
          })
        }
      })
    },
  },

  effects: {
    *clearstore({ payload = {} }, { call, put, select }) {
      yield put({
        type: 'updateState',
        payload: {},
      })
    },
    *query({ payload = {} }, { call, put }) {
      // console.log("call map query");
    },
  },

  reducers: {},
})
